package com.blazingredfireball.rouleurlog.ria.business
{
	import mx.rpc.IResponder;
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.blazingredfireball.rouleurlog.ria.vo.RideVO;
	
	public class RideDelegate
	{
		private var responder : IResponder;
		private var service : Object;
		
		public function RideDelegate(responder : IResponder)
		{
			this.service = ServiceLocator.getInstance().getService( "rideService" );
			this.responder = responder;
		}
		
		public function getRides(user_id : int) : void
		{			
			// For now I will not send user_id, just get all results. 
			// Future var call : Object = service.getRides( user_id );
			var call : Object = service.getRides();
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
		public function createRide(ride : Object) : void
		{			
			var call : Object = service.createRide(ride);
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
		public function deleteRide(id : int) : void
		{			
			var call : Object = service.deleteRide(id);
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
		public function updateRide(id : int, ride : Object) : void
		{			
			var call : Object = service.updateRide(id, ride);
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
	}
}